﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using System.IO;
using System.Windows.Controls;
using BluSteamClient.Model.Entities;

namespace BluSteamClient.Model
{
    public class UsersList
    {
        #region Properties

        public List<string> ListUsersString
        {
            get;
            set;
        }

        #endregion

        #region Methods

        public void SetUserList(string xml)
        {
            ConnectedUserList connectedUserList = this.Deserialize(xml);
            this.ListUsersString = connectedUserList.Users;        
        }

        private ConnectedUserList Deserialize(string xml)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ConnectedUserList));
            using (StringReader reader = new StringReader(xml))
            {
                return serializer.Deserialize(reader) as ConnectedUserList;
            }
        }

        #endregion
    }
}
